import 'package:flutter/material.dart';

final desserts = [
  DessertSection('Cakes', 'https://www.cocinayvino.com/wp-content/uploads/2016/12/50966188_l-696x464.jpg'),
  DessertSection('Dessert and sweet', 'https://i.redd.it/pclcxx7yat731.jpg'),
  DessertSection('Cookies and pastries',
      'https://www.whats4eats.com/files/course-desserts-macarons-flickr-68711844%40N07-Michael-Stern-15204286153-4x3.jpg'),
  DessertSection(
      'Salty', 'https://www.modernhoney.com/wp-content/uploads/2019/07/Chocolate-Caramel-Pretzel-Bark-9.jpg'),
];

class DessertSection {
  String title;
  String thumbnail;

  DessertSection(this.title, this.thumbnail);
}

class DessertView extends StatelessWidget {
  final dessert;

  const DessertView(this.dessert);

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 20.0),
      child: Material(
        elevation: 5,
        borderRadius: BorderRadius.all(Radius.circular(20.0)),
        child: ClipRRect(
          borderRadius: BorderRadius.circular(20.0),
          child: Stack(
            alignment: AlignmentDirectional.bottomCenter,
            children: <Widget>[
              Image.network(dessert.thumbnail),
              Container(
                height: 60,
                width: double.infinity,
                color: Colors.white.withOpacity(0.8),
                alignment: AlignmentDirectional.center,
                child: Text(
                  dessert.title,
                  style: TextStyle(
                    fontSize: 20.0,
                    color: Colors.black,
                    fontWeight: FontWeight.w700
                  ),
                ),
              )
            ],
          ),
        ),
      ),
    );
  }

}